import {defineConfig} from 'vite'
import react from '@vitejs/plugin-react-swc'
import path from 'path'

// https://vitejs.dev/config/
export default defineConfig({
    plugins: [react()],
    resolve: {
        alias: {
            '@': path.resolve(__dirname, 'src'),
        }
    },
    server: {
        host: "0.0.0.0",
        port: 8080,
        proxy: {
            "/api": {
                // secure: true, // 如果是 https ,需要开启这个选项
                target: "http://192.168.1.194:3000", // 实际请求地址(远程线上地址)
                rewrite: (path) => path.replace(/^\/api/, ''), // 去掉/api前缀
            },
        },
    },
})
